package model23;

/**
 * @Author ilongsay
 * @Date: Create in 2019/10/10 15:16
 * @Description: don't bb,show you code
 */
public interface AdaptHandler {

    public boolean support(Controller controller);

    public void handler(Controller controller);
}

class SimpleControllerHandler implements AdaptHandler{

    @Override
    public boolean support(Controller controller) {
        return (controller instanceof SimpleController);
    }

    @Override
    public void handler(Controller controller) {
        SimpleController simpleController = (SimpleController) controller;
        simpleController.doSimpleSomething();
    }
}
class RestControllerHandler implements AdaptHandler{

    @Override
    public boolean support(Controller controller) {
        return (controller instanceof RestController);
    }

    @Override
    public void handler(Controller controller) {
        RestController restController = (RestController) controller;
        restController.doRestSomething();
    }
}

class HttpControllerHandler implements AdaptHandler{


    @Override
    public boolean support(Controller controller) {
        return (controller instanceof HttpController);
    }

    @Override
    public void handler(Controller controller) {
        HttpController httpController = (HttpController) controller;
        httpController.doHttpSomething();
    }
}